import React from 'react';
import {Switch, Route, Redirect} from 'react-router-dom'
import {featureRoutes} from './routes'
import Frame from './pages/frame/Index'
import { ConfigProvider } from 'antd';
import locale from 'antd/lib/locale/zh_CN';
import 'moment/locale/zh-cn';
import './App.css';

class App extends React.Component{
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <ConfigProvider locale={locale}>
                <Frame>
                    <Switch>
                        {featureRoutes.map(route => {
                            return (
                                <Route key={route.path} path={route.path} exact={route.exact} render={routeProps => {
                                    return (<route.component {...routeProps}></route.component>);
                                }}>
                                </Route>
                            )
                        })}
                        <Redirect to={featureRoutes[0].path} from="/eip"></Redirect>
                        <Redirect to="/404"></Redirect>
                    </Switch>
                </Frame>
            </ConfigProvider>
        );
    }
}

export default App;
